package main

import (
	"errors"
	"fmt"
	"gitee-lfs-multipart-transfer/internal/args"
	"os"
)

func main() {
	if err := run(); err != nil {
		fmt.Fprintf(os.Stderr, "run uploader error: %v\n", err)
		os.Exit(1)
	}

	fmt.Fprintln(os.Stderr, "run uploader success")
}

func run() error {
	arg, err := args.NewArgs()
	if err != nil {
		return fmt.Errorf("args init error: %w", err)
	}

	if arg.LfsEnableMultipart != "" {
		return CmdEnableMultipartTransfer(arg.LfsEnableMultipart)
	}

	if arg.LfsMultipartUpload {
		return CmdMultipartuploader()
	}

	return errors.New("no action specified")
}
